package com.cqcj.login.web;

import com.cqcj.login.service.BrandService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/deleteBrandServlet")
public class DeleteBrandServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        BrandService brandService = new BrandService();
        String id = request.getParameter("id");
        brandService.deleteBrand(Integer.parseInt(id));
        String contextPath = request.getContextPath();
        response.sendRedirect(contextPath + "/selectBrandAllServlet");
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
